package mvc.bezier;


import java.awt.Dimension;
import java.util.ArrayList;

import javax.media.opengl.GL;
import javax.swing.JLabel;

import org.geom.Vector3D;
import org.geom.curve.ICurve;
import org.geom.render.ViewJOGL;


public class BezierView3D extends ViewJOGL {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public static boolean curvePointVisibility = true;
	public static boolean controlPointVisibility = true;
	
	public BezierMouseController3D controller;
	
	public ICurve curve;
	

	public BezierView3D(ICurve model, Dimension d) {
		super(d);
		this.curve = model;
				
		add(new JLabel("3d view"));
	}
	
	public void render(GL gl) {
		ArrayList<Vector3D> controls = ((BezierModel)curve).getControlPoints();

		drawCenter(gl);
		if(curvePointVisibility)drawCurvePoints(curve.getPoints(), gl);
		if(controlPointVisibility)drawPoints(controls, gl);
	}

	public void addMouseKeybController(BezierMouseController3D controller3d) {
		controller = controller3d;
		addMouseListener(controller3d);
		addMouseMotionListener(controller3d);
		addKeyListener(controller3d);
	}


}
